<?php
require_once("includes/head.php"); if (!$_GET['ajax']) require_once("includes/head_start.php"); 


/* ustawianie graczom avatarow ktore odpowiadaja nazwami ich id
$lista = $db -> execute("select avatar, id from players where avatar != ''");
while (!$lista -> EOF)
{
	if (ereg(".png", strtolower($lista -> fields['avatar']))) 
	{
		if (!copy("avatars/".$lista -> fields['avatar'], "avatars/".$lista -> fields['id'].".png")) echo('Blad kopiowania '.$lista -> fields['avatar'].'<br>');
		$db -> execute("update players set avatar='".$lista -> fields['id'].".png' where id=".$lista -> fields['id']);
		
	} elseif (ereg(".jpg", strtolower($lista -> fields['avatar']))) 
	{
		if (!copy("avatars/".$lista -> fields['avatar'], "avatars/".$lista -> fields['id'].".jpg")) echo('Blad kopiowania '.$lista -> fields['avatar'].'<br>');
		$db -> execute("update players set avatar='".$lista -> fields['id'].".jpg' where id=".$lista -> fields['id']);

	} elseif (ereg(".gif", strtolower($lista -> fields['avatar']))) 
	{
		if (!copy("avatars/".$lista -> fields['avatar'], "avatars/".$lista -> fields['id'].".gif")) echo('Blad kopiowania '.$lista -> fields['avatar'].'<br>');
		$db -> execute("update players set avatar='".$lista -> fields['id'].".gif' where id=".$lista -> fields['id']);
	} else {
		echo('Niepasuje: '.$lista -> fields['avatar'].'<br>');
	}
echo($lista -> fields['id'].' <br>');

$lista -> movenext();
}
$lista -> close();
*/

/* usuwanie calej reszty avatarow
$dir = opendir("avatars/");
while ($file = readdir($dir)) 
{
	if (strlen($file) > 10) echo $file.'<br>';
	if (strlen($file) > 10) unlink("avatars/".$file);
}
*/

?>